{extend name="base" /}
{block name="content"}
<script language="javascript" type="text/javascript" src="__STATIC__/public/My97DatePicker/WdatePicker.js"></script>
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>系统</span>
            <span class="icon-angle-right"></span>
            <span>广告</span>
            <span class="icon-angle-right"></span>
            <span>{$info ? '编辑' : '添加'}广告</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                            <tr>
                                <th colspan="2">{$info ? '编辑' : '添加'}广告</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td width="15%"><label for="title">广告标题<em>*</em></label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="title" id="title" placeholder="请输入广告标题" value="{$info.title}" /></td>
                            </tr>
                            <tr>
                                <td><label for="">广告分类<em>*</em></label></td>
                                <td>
                                    <div class="lay-select">
                                        <select name="category_id">
                                            <option value="0">请选择广告分类</option>
                                            {foreach name="categories" item="category"}
                                            <option value="{$category.id}"{if condition="$info['category_id'] eq $category['id']"} selected{/if}>{$category.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><label for="">图片<em>*</em></label></td>
                                <td>
                                    <button type="button" class="layui-btn u-upload-pic" data-name="image_id"><i class="layui-icon">&#xe67c;</i>上传图片</button>
                                    <div class="m-pic">
                                        <ul>
                                            {:attach_html($info.image_id, 'image_id')}
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><label for="url">链接地址</label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="url" id="url" placeholder="请输入链接地址" value="{$info.url}" /></td>
                            </tr>
                            <tr>
                                <td width="15%"><label for="">打开方式</label></td>
                                <td>
                                    <div class="lay-select">
                                        <select name="target">
                                            <option value="0"{if condition="$info['target'] eq 0"} selected{/if}>原窗口打开</option>
                                            <option value="1"{if condition="$info['target'] eq 1"} selected{/if}>新窗口打开</option>
                                        </select>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><label for="">有效期开始日期</label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="start_time" id="start_time" placeholder="请选择有效期开始日期" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="{$info.start_time ?: ''}" readonly /></td>
                            </tr>
                            <tr>
                                <td><label for="">有效期结束日期</label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="expire_time" id="expire_time" placeholder="请选择有效期结束日期" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="{$info.expire_time ?: ''}" readonly /></td>
                            </tr>
                            <tr>
                                <td><label for="list_order">排序</label></td>
                                <td><input type="text" class="u-ipt u-ipt-tiny" name="list_order" id="list_order" placeholder="请输入排序值" value="{$info.list_order ?: 0}" /><span>值越大越排在前面</span></td>
                            </tr>
                            <tr>
                                <td><label for="description">描述</label></td>
                                <td><div class="m-textarea"><textarea name="description" class="u-tarea" id="description" placeholder="请输入描述">{$info.description}</textarea></div></td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="m-form-btn"><input type="hidden" name="id" value="{$info.id}"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="extrajs"}
{include file="public:upload"/}
{/block}